package the_fourth_chapter;

public class Matrix {

	public static void main(String[] args) {
		// 初始化二维数组
		int[][] m1 = new int[3][4];
		int[][] m2 = { { 41, 30, 42, 64 }, { -24, 53, 9, 10 }, { 1, 42, 54, 100 } };

		int[][] m3 = new int[3][4];
		// 二维数组看列m1[0].length
		// System.out.println(m1[0].length);

		// 为数组m1赋值
		for (int i = 0; i < m1.length; i++) {
			for (int j = 0; j < m1[0].length; j++) {
				m1[i][j] = 10 * (i + 1) + (j + 1);
			}
		}

		// 数组求和
		for (int i = 0; i < m1.length; i++) {
			for (int j = 0; j < m1[0].length; j++) {
				m3[i][j] = m1[i][j] + m2[i][j];
			}
		}

		// 打印数组
		for (int i = 0; i < m1.length; i++) {
			for (int j = 0; j < m1[0].length; j++) {
				System.out.print(m3[i][j] + "\t");
			}
			System.out.println();
		}
	}
}
